<?php
  defined('_JEXEC') or die();
  jimport('joomla.application.component.model');
  require_once('base.php');
  
  class ByeModelBye extends BaseModel
  {     
    var $_name = "bye";
    var $_table = "#__pbny_byes";
    
    function get_by($start_date = null, $end_date = null, $published = null){
      
      $where = " WHERE true";
      if(isset($start_date))
        $where .= " AND start_date >= '$start_date' ";
        
      if(isset($end_date))
        $where .= " AND start_date <= '$end_date' ";
        
      if(isset($published))
        $where .= " AND published = $published ";
        
      $sql = 'SELECT * '.
             'FROM '.$this->_table.
           $where;

      return $this->_get($sql);
      
    }
  }
?>